/***********************************************************************************************************************************
 *    Name: 
 *  Author: Frank Figearo — http://www.sqlnerd.me/ — frank@sqlnerd.me
 * Summary: 
**/

DECLARE @xe_create NVARCHAR(MAX)= N'CREATE EVENT SESSION DBAdmin_Waits ON SERVER
ADD EVENT sqlserver.locks_lock_waits,
ADD EVENT sqlos.wait_info (WHERE opcode = 1)
ADD TARGET package0.asynchronous_file_target (SET filename= N''' + master.DBAdmin.GetInstancePath(N'ErrorDumpDir') + N'DBAdmin_Waits.xel' + ''');
ALTER EVENT SESSION DBAdmin_Waits ON SERVER STATE= START;';
EXECUTE (@xe_create);
GO